<?php
class worksRecent extends CWidget
{
	public $htmlOptions = array();

	public $length = 30;
	
	public $id = 'recentWorks';
	
	public $view = 'works';
	
	public $limit = 5;
	
	public $dataProvider;
	
	public function getData()
	{
		
		$this->dataProvider = Media::model()->findAll(array(
			'condition'=>'media_status = :media_status',
			'limit'=>$this->limit,
			'order'=>'media_id DESC',
			'params'=>array(
				':media_status'=>Media::STATUS_PUBLISHED
			)
		));
	}
	
	
	public function run()
	{	
		$this->getData();
		
// 		UtilTools::dump($this->dataProvider);
		
		$this->render($this->view,array(
			'dataProvider' => $this->dataProvider
		));
	}
}
?>